#ifndef EDGE_H
#define EDGE_H

#include <iostream>
#include "point.h"

class Vertex;
class Face;

class Edge{
    public:
        Edge(int = 0, bool = false);
        Edge(int, Vertex *, Vertex *, bool = false);
        ~Edge();

        int getID() const;

        void select(bool);
        bool isSelected();

        void setIsBoundary(bool);
        bool isBoundary();

        void setStart(Vertex *);
        Vertex *getStart();

        void setEnd(Vertex *);
        Vertex *getEnd();

        void setClockwise(Face *);
        Face *getClockwise();

        void setCounterClockwise(Face *);
        Face *getCounterClockwise();

        void setNextClockwise(Edge *, bool);
        Edge *getNextClockwise();
        bool getNextClockwiseSignal();

        void setPreviousClockwise(Edge *, bool);
        Edge *getPreviousClockwise();
        bool getPreviousClockwiseSignal();

        void setNextCounterClockwise(Edge *, bool);
        Edge *getNextCounterClockwise();
        bool getNextCounterClockwiseSignal();

        void setPreviousCounterClockwise(Edge *, bool);
        Edge *getPreviousCounterClockwise();
        bool getPreviousCounterClockwiseSignal();

        void print() const;

    private:
        int id;
        bool selected;
        bool inBoundary;

        Vertex *start;
        Vertex *end;
        Face *clockwise;
        Face *counterClockwise;
        Edge *nextClockwise;
        bool nextClockwiseSignal; //1 - normal | 0 - inverse
        Edge *previousClockwise;
        bool previousClockwiseSignal; //1 - normal | 0 - inverse
        Edge *nextCounterClockwise;
        bool nextCounterClockwiseSignal; //1 - normal | 0 - inverse
        Edge *previousCounterClockwise;
        bool previousCounterClockwiseSignal; //1 - normal | 0 - inverse
};

bool isParallel(Edge, Edge);
bool haveIntersection(Edge, Edge);
bool haveIntersection(Point, Point, Point, Point);

#endif
